package com.cnsoft;


import org.cnsoft.framework.beans.MyBeanFactoryHelper;
import org.cnsoft.framework.config.ISystemConfig;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;

//@SpringBootApplication
//自定义扫描路径
//@ComponentScan({"org.cnsoft","com.cnsoft"})
public class RunningApplication2 extends SpringBootServletInitializer implements ApplicationRunner{

    //////////////////////////////////////启动运行/////////////////////////////////////////////
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        SpringApplication springApplication = builder.application();
		springApplication.setBannerMode(Banner.Mode.OFF);
		builder.sources(RunningApplication2.class);
        return builder;
    }
	public static void main(String[] args) {
        SpringApplication springApplication = new SpringApplication(RunningApplication2.class);
		springApplication.setBannerMode(Banner.Mode.OFF);
        springApplication.run(args);
        RunningApplication2.run();
	}
	
    ////////////////////////////////////////启动后加载内容////////////////////////////////////////
	public static void run() {
		try {
			ISystemConfig system = MyBeanFactoryHelper.getBean(ISystemConfig.class);
			system.start();
			System.out.println("=============system start=============");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	public void run(ApplicationArguments args) throws Exception {
//		ISystemConfig system = MyBeanFactoryHelper.getBean(ISystemConfig.class);
//		system.start();
	}
}
